#!/usr/bin/perl
#
# Generate an E-mail about a Linux Counter entry - internationalized version
# Used after registration, update or delete
#
use strict;
no strict "vars";
use lib "$ENV{COUNTER_ROOT}/lib-i18n";

# when this is run from a script, label properly
use CGI::Carp;
use Counter::Sendemail;
use Getopt::Long;

while ($ARGV[0] =~ /^-/) {
    $opt = shift;
    if ($opt eq "-t") {
      Counter::Sendemail::test(1);
    } elsif ($opt eq "-d") {
	$Counter::Sendemail::DEBUG = 1;
    } elsif ($opt eq "-m") {
	$messagefile = shift;
	open(M, $messagefile) || die "Message file not found\n";
	@message = <M>;
	$message = join("", @message);
    } elsif ($opt eq "--dump") {
	Counter::Sendemail::dumptexts();
	exit(0);
    }
}
$key = shift;

Counter::Sendemail::sendemail($key, $message, @_);



